package com.xinhe.web.reposity;

import com.xinhe.web.entity.ValueConfig;
import com.xinhe.web.entity.WeixinUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface WeixinUserRepository extends JpaRepository<WeixinUser, Long> {
    @Query(value = "select *  from tb_weixin_user  where removed = 0 and f_config_id = ?1 and f_user_id = ?2", nativeQuery = true)
    WeixinUser findOneByConfigIdAndUserId(long configId, Long userId);

    @Query(value = "select *  from tb_weixin_user  where removed = 0 and openid = ?1", nativeQuery = true)
    WeixinUser findOneByOpenid(String openid);
    @Query(value = "select *  from tb_weixin_user  where removed = 0 and unionid = ?1", nativeQuery = true)
    List<WeixinUser> findByUnionid(String unionid);
}
